package com.spdzen.model;


import com.baomidou.mybatisplus.activerecord.Model;
import java.util.Date;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.spdzen.support.validation.AddValidGroup;
import com.spdzen.support.validation.UpdateValidGroup;
import com.baomidou.mybatisplus.annotations.TableId;
import java.io.Serializable;


/**
 * <p>
 * 新闻
 * </p>
 *
 * @author accountwcx@qq.com
 * @since 2017-03-16
 */
@TableName("spd_news")
public class News extends Model<News> {

    private static final long serialVersionUID = 1L;

    /**
     * 自增主键
     */
    @NotNull(groups = {UpdateValidGroup.class})
	@TableId("id")
	private Long id;
    /**
     * 新闻标题
     */
    
	@Length(min = 1, max = 50, groups = {UpdateValidGroup.class, AddValidGroup.class})
	@TableField("title")
	private String title;
    /**
     * 外键spd_news_category.id
     */

	@Min(value = 1L, groups = {UpdateValidGroup.class, AddValidGroup.class})
	@TableField("news_category_id")
	private Long newsCategoryId;
    /**
     * 新闻类型，1表示图文，2表示图集
     */

	@TableField("type")
	private Integer type;
    /**
     * 作者或新闻来源
     */

	@TableField("author")
	private String author;
    /**
     * 是否置顶，0不置顶，1置顶
     */

	@TableField("is_top")
	private Integer isTop;
    /**
     * 封面图片保存路径
     */

	@NotBlank(groups = {UpdateValidGroup.class, AddValidGroup.class})
	@TableField("cover_image")
	private String coverImage;
    /**
     * 文章内容（如果是图集的话，是图集JSON数组）
     */

	@TableField("content")
	private String content;
    /**
     * 发布状态，1表示发布，2表示不发布
     */

	@TableField("publish_status")
	private Integer publishStatus;
    /**
     * 操作时间（创建/更新）
     */

	@TableField("operate_time")
	private Date operateTime;
    /**
     * 操作人id，外键spd_sys_user.id
     */

	@TableField("operate_id")
	private Long operateId;


	public Long getId() {
		return id;
	}

	public News setId(Long id) {
		this.id = id;
		return this;
	}

	public String getTitle() {
		return title;
	}

	public News setTitle(String title) {
		this.title = title;
		return this;
	}

	public Long getNewsCategoryId() {
		return newsCategoryId;
	}

	public News setNewsCategoryId(Long newsCategoryId) {
		this.newsCategoryId = newsCategoryId;
		return this;
	}

	public Integer getType() {
		return type;
	}

	public News setType(Integer type) {
		this.type = type;
		return this;
	}

	public String getAuthor() {
		return author;
	}

	public News setAuthor(String author) {
		this.author = author;
		return this;
	}

	public Integer getIsTop() {
		return isTop;
	}

	public News setIsTop(Integer isTop) {
		this.isTop = isTop;
		return this;
	}

	public String getCoverImage() {
		return coverImage;
	}

	public News setCoverImage(String coverImage) {
		this.coverImage = coverImage;
		return this;
	}

	public String getContent() {
		return content;
	}

	public News setContent(String content) {
		this.content = content;
		return this;
	}

	public Integer getPublishStatus() {
		return publishStatus;
	}

	public News setPublishStatus(Integer publishStatus) {
		this.publishStatus = publishStatus;
		return this;
	}

	public Date getOperateTime() {
		return operateTime;
	}

	public News setOperateTime(Date operateTime) {
		this.operateTime = operateTime;
		return this;
	}

	public Long getOperateId() {
		return operateId;
	}

	public News setOperateId(Long operateId) {
		this.operateId = operateId;
		return this;
	}

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

}